<template>
  <div>
    <table>
      <tr>
        <th>部门ID</th>
        <th>部门名称</th>
        <th>上层部门id</th>
        <th>部门介绍</th>
      </tr>
      <tr v-for="item in items" :key="item.id">
        <td>{{ item.departmentId }}</td>
        <td>{{ item.departmentName }}</td>
        <td>{{ item.parentDepartmentId }}</td>
        <td>{{ item.departmentDescription }}</td>
      </tr>
    </table>
  </div>
</template>

<script>
import axios from 'axios';

export default {
  data() {
    return {
      items: []
    };
  },
  created() {
    axios.get('http://localhost:8080/department/getAll')
      .then(response => {
        this.items = response.data;
      })
      .catch(error => {
        console.log(error);
      });
  }
};
</script>